import { ElNotification } from "element-plus";
import { ref } from "vue";
import { establishmentRegistrationApi } from "../../../api/user";

export const useNotice = function () {
  const noticeRef = ref([]);
  const countRef = ref(0);
  const hasNoticeRef = ref(false);
  // establishmentRegistrationApi().then((resp) => {
  //   const { code, msg, data } = resp;
  //   noticeRef.value = data;
  //   countRef.value = data?.company ? 1 : 0;
  //   if (data?.company) {
  //     hasNoticeRef.value = true;
  //     setTimeout(() => {
  //       ElNotification({
  //         title: "通知",
  //         message: "你有新的消息",
  //       });
  //     }, 1000);
  //   }
  // });
  return {
    notice: noticeRef,
    count: countRef,
    hasNotice: hasNoticeRef,
  };
};
